package com.foreknow.demo16;

public class Thread2 implements Runnable {
    @Override
    public void run() {
        synchronized (WaitSleepDemo.class) {
            System.out.println("进入线程Thread2");
            System.out.println("Thread2 is sleeping");
            //唤醒等待的线程
                WaitSleepDemo.class.notify();
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("线程Thread2继续执行");
            System.out.println("Thread2执行结束了......");
        }
    }
}
